class ForumsController < ApplicationController
  # GET /forums/:id
  def show
    # TODO use one or two request?
    @forum = Forum.find(params[:id], :select => 'forums.id, forums.name, forums.permalink', :include => [:category[:name]])
    @topics = @forum.topics.find(
      :all, :limit => 25,
      :select => 'topics.id, topics.title, topics.permalink, topics.posts_count, topics.hits, topics.replied_by, topics.replied_at',
      :include => [:user[:login], :replied_by_user[:login]]
    )
    
    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @forum.to_xml }  # show.rxml
    end
  rescue ActiveRecord::RecordNotFound
    flash[:error] = _('Forum not found')
    redirect_back_or(home_path)
  end
end
